﻿#pragma once

#include "Event.h"

namespace Hazel {

	class KeyPressedEvent : public Event
	{
	public:
		KeyPressedEvent(int keycode, int scancode, int modifiers, int repeatCount)
			: m_KeyCode(keycode), m_Scancode(scancode), m_Modifiers(modifiers), m_RepeatCount(repeatCount) {}

		inline int GetKeyCode() const { return m_KeyCode; }
		inline int GetScancode() const { return m_Scancode; }
		inline int GetModifiers() const { return m_Modifiers; }
		inline int GetRepeatCount() const { return m_RepeatCount; }

		std::string ToString() const override
		{
			std::stringstream ss;
			ss << "KeyPressedEvent: " << m_KeyCode << " (repeat=" << m_RepeatCount << ")";
			return ss.str();
		}

		EVENT_CLASS_TYPE(KeyPressed)
		EVENT_CLASS_CATEGORY(EventCategoryKeyboard | EventCategoryInput)

	private:
		int m_KeyCode, m_Scancode, m_Modifiers, m_RepeatCount;
	};

	class KeyReleasedEvent : public Event
	{
	public:
		KeyReleasedEvent(int keycode, int scancode, int modifiers)
			: m_KeyCode(keycode), m_Scancode(scancode), m_Modifiers(modifiers) {}

		inline int GetKeyCode() const { return m_KeyCode; }
		inline int GetScancode() const { return m_Scancode; }
		inline int GetModifiers() const { return m_Modifiers; }

		std::string ToString() const override
		{
			std::stringstream ss;
			ss << "KeyReleasedEvent: " << m_KeyCode;
			return ss.str();
		}

		EVENT_CLASS_TYPE(KeyReleased)
		EVENT_CLASS_CATEGORY(EventCategoryKeyboard | EventCategoryInput)

	private:
		int m_KeyCode, m_Scancode, m_Modifiers;
	};

	class KeyTypedEvent : public Event
	{
	public:
		KeyTypedEvent(unsigned int keycode)
			: m_KeyCode(keycode) {}

		inline unsigned int GetKeyCode() const { return m_KeyCode; }

		std::string ToString() const override
		{
			std::stringstream ss;
			ss << "KeyTypedEvent: " << m_KeyCode;
			return ss.str();
		}

		EVENT_CLASS_TYPE(KeyTyped)
		EVENT_CLASS_CATEGORY(EventCategoryKeyboard | EventCategoryInput)

	private:
		unsigned int m_KeyCode;
	};

} // namespace Hazel